fix(test): eliminate slow test hangs in onboard and smoke suites#1589
fix(test): eliminate slow test hangs in onboard and smoke suites#1589
Conversation
The "interactive mode auto-recreates" test mocked childProcess.spawn but streamSandboxCreate imports spawn at load time from its own "node:child_process" reference, bypassing the mock. This caused a real bash process to try to hit a live gateway, hanging for 87s+ until vitest's timeout killed it. Fix by using streamSandboxCreate's spawnImpl option to inject the fake spawn, preventing any real subprocess from being created. Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
…d tests - Add 10s timeout to smoke-macos-install pipe test to prevent hang - Mock dashboard readiness curl check in 4 onboard createSandbox tests that were sleeping 28s each through unmocked polling loop Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
📝 WalkthroughWalkthroughTest mocking infrastructure updated: Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/smoke-macos-install.test.js (1)
84-84: Redundantit.skipwhen parentdescribe.skipis already applied.Since the entire suite at line 10 uses
describe.skip, this individualit.skiphas no additional effect—all tests in the suite are already skipped. Consider removing the redundant.skiphere, or if this is intentional documentation of which specific test was problematic, add a comment explaining why.♻️ Suggested simplification
- it.skip("stages the policy preset no answer after sandbox setup", () => { + it("stages the policy preset no answer after sandbox setup", () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/smoke-macos-install.test.js` at line 84, The test case "stages the policy preset no answer after sandbox setup" is redundantly marked with it.skip while the containing suite uses describe.skip; remove the redundant .skip on that it (change it.skip(...) to it(...)) or, if you intentionally want to document that this specific test was problematic, replace the .skip removal with a brief inline comment above the it explaining why it was skipped (referencing the test string "stages the policy preset no answer after sandbox setup" to locate the node).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/smoke-macos-install.test.js`:
- Line 84: The test case "stages the policy preset no answer after sandbox
setup" is redundantly marked with it.skip while the containing suite uses
describe.skip; remove the redundant .skip on that it (change it.skip(...) to
it(...)) or, if you intentionally want to document that this specific test was
problematic, replace the .skip removal with a brief inline comment above the it
explaining why it was skipped (referencing the test string "stages the policy
preset no answer after sandbox setup" to locate the node).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9fb5823b-dfa3-4df6-b1cf-7ec0d7d9d43e
📒 Files selected for processing (2)
test/onboard.test.jstest/smoke-macos-install.test.js
Summary
streamSandboxCreatespawn injection in onboard interactive test to prevent 87s+ hang from real subprocess hitting a live gatewaycreateSandboxtests that were sleeping 28s each through unmocked polling loopsmoke-macos-installpipe test to prevent hangCherry-picked from #1587 (test-only commits).
Test plan
vitest run --project clipassesSummary by CodeRabbit
Release Notes